package mysql

type Schema struct {
	Name      string `xorm:"'SCHEMA_NAME'"`
	CharSet   string `xorm:"'DEFAULT_CHARACTER_SET_NAME'"`
	Collation string `xorm:"'DEFAULT_COLLATION_NAME'"`
}

func (Schema) TableName() string {
	return "SCHEMATA"
}

func (s Schema) getSchemas(repo *Repo) (items []Schema, err error) {
	items=make([]Schema,0)
	if s.Name!="" {
		if err = repo.engine.Where("SCHEMA_NAME=?",s.Name).Find(&items); err != nil {
			return nil, err
		}
	}else{
		if err = repo.engine.Find(&items); err != nil {
			return nil, err
		}
	}
	return items, nil
}

